#! /bin/sh
#
# $Id: startup.sh,v 1.2.2.1 1999/09/09 01:45:27 gonzo Exp $

# Shell script to startup the server

# This script is known to work with the standard Korn Shell under
# Solaris and the MKS Korn shell under Windows.

# There are other, simpler commands to startup the runner. The two
# commented commands good replacements. The first works well with
# Java Platform 1.1 based runtimes. The second works well with
# Java2 Platform based runtimes.

#jre -cp runner.jar:servlet.jar:classes com.sun.web.shell.Startup $*
#java -cp runner.jar:servlet.jar:classes com.sun.web.shell.Startup $*

baseDir=`dirname $0`

jsdkJars=${baseDir}/webserver.jar:${baseDir}/lib/jakarta.jar:${baseDir}/lib/servlet.jar
jspJars=${baseDir}/lib/jsp.jar:${baseDir}/lib/jspengine.jar
beanJars=${baseDir}/examples/WEB-INF/jsp/beans:${baseDir}/webpages/WEB-INF/jsp/beans:${baseDir}/webpages/WEB-INF/servlets
miscJars=${baseDir}/lib/xml.jar
appJars=${jsdkJars}:${jspJars}:${beanJars}:${miscJars}
sysJars=${JAVA_HOME}/lib/tools.jar

appClassPath=${appJars}
cp=$CLASSPATH

# Backdoor classpath setting for development purposes when all classes
# are compiled into a /classes dir and are not yet jarred.

if [ -d ${baseDir}/classes ]; then
    appClassPath=${baseDir}/classes:${appClassPath}
fi

CLASSPATH=${appClassPath}:${sysJars}
export CLASSPATH

if [ "$cp" != "" ]; then
    CLASSPATH=${CLASSPATH}:${cp}
    export CLASSPATH
fi

echo Using classpath: ${CLASSPATH}

# We start the server up in the background for a couple of reasons:
#   1) It frees up your command window
#   2) You should use `stopserver` instead of ^C to bring down the server

java com.sun.web.shell.Startup $* &

if [ "$cp" != "" ]; then
    CLASSPATH=${cp}
    export CLASSPATH
else
    unset CLASSPATH
fi
